package com.mxpio.erp.common.jpa.model;

import java.math.BigDecimal;
import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Id;
import javax.persistence.MappedSuperclass;

import com.mxpio.erp.common.jpa.policy.BizCodeGeneratorPolicy;
import com.mxpioframework.jpa.BaseEntity;
import com.mxpioframework.jpa.annotation.Generator;

import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;

/**
 * 计划单据父类
 * @author MxpIO
 */
@Data
@MappedSuperclass
@EqualsAndHashCode(callSuper=false)
public abstract class BizPlan extends BaseEntity {

	private static final long serialVersionUID = 1L;

	public BizPlan(){
		super();
		this.setTypeCode(initTypeCode());
	}

	@Id
	@Column(name = "PLAN_NO_", updatable = false)
	@Generator(policy = BizCodeGeneratorPolicy.class)
	@ApiModelProperty(value = "业务单号")
	private String planNo;


	@Column(name = "TYPE_CODE_", updatable = false)
	@ApiModelProperty(value = "订单类型")
	private String typeCode;
	
	@Column(name = "ITEM_CODE_", updatable = false)
	@ApiModelProperty(value = "物料编码")
	private String itemCode;
	
	@Column(name = "QUANTITY_")
	@ApiModelProperty(value = "计划数量")
	private BigDecimal quantity;
	
	@Column(name = "DELIVER_DATE_")
	@ApiModelProperty(value = "交付日期")
	private Date deliverDate;

	public abstract String initTypeCode();
}
